package com.tools.ringtone.edit;

import android.app.Dialog;
import android.content.Context;
import android.os.Message;
import android.view.View;
import android.view.Window;
import android.widget.Button;

import com.mp3.dwonloader.ringtonemaker.musicradio.zl.R;




public class TypeSelectDialog extends Dialog {

	private final Message mResponse;

	public TypeSelectDialog(Context context, Message response) {
		super(context);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.ringtone_type_select);
		// setTitle(R.string.alert_title_success);

		((Button) findViewById(R.id.button_make_default))
				.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						closeAndSendResult(R.id.button_make_default);
					}
				});
		((Button) findViewById(R.id.button_choose_contact))
				.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						closeAndSendResult(R.id.button_choose_contact);
					}
				});
		((Button) findViewById(R.id.button_do_nothing))
				.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						closeAndSendResult(R.id.button_do_nothing);
					}
				});

		mResponse = response;
	}

	private void closeAndSendResult(int clickedButtonId) {
		mResponse.arg1 = clickedButtonId;
		mResponse.sendToTarget();
		dismiss();
	}
}
